local zhenbi = fk.CreateSkill{
  name = "lingling__zhenbi",
}

Fk:loadTranslationTable{
  ["lingling__zhenbi"] = "震壁",
  [":lingling__zhenbi"] = "你使用【杀】可以无视距离额外指定一名目标。",

  ["#lingling__zhenbi-choose"] = "震壁：你可以为此%arg额外指定一个目标",
}

zhenbi:addEffect(fk.AfterCardTargetDeclared, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zhenbi.name) and data.card.trueName == "slash" and
      #data:getExtraTargets({bypass_distances = true}) > 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = data:getExtraTargets({bypass_distances = true}),
      skill_name = zhenbi.name,
      prompt = "#lingling__zhenbi-choose:::"..data.card:toLogString(),
      cancelable = true,
    })
    if #tos > 0 then
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    data:addTarget(event:getCostData(self).tos[1])
  end,
})

return zhenbi
